<!DOCTYPE html>
<html >
<head>
    <meta charset="UTF-8">
    <title>angular</title>
	<script type="text/javascript" src="../购物车/js/jquery-1.11.2.min.js" ></script>
	<script type="text/javascript" src="../js/angular.js" ></script>
	<script type="text/javascript" src="../js/angular-sanitize.js" ></script>

</head>
<body  ng-app="myAppsss" ng-controller="MyContsssssroller">
</body>
    <script>
        angular.module('myAppsss', [])
            .controller('MyContsssssroller', ['$scope','$compile',function($scope, $compile){
                // 创建编译函数
                var compileFn = $compile('<div a ng-click="'+"quitTo()"+'">我好帅</div>');
                // 传入scope，得到编译好的dom对象(已封装为jqlite对象)
                // 也可以用$scope.$new()创建继承的作用域
                var $dom = compileFn($scope); 
                // 添加到文档中
                $dom.appendTo('body');   
                $scope.quitTo=function(){
                	alert("成功");
                }
               
            }])
            
    </script>
</html>
